<?php
header('Content-Type:text/html;charset=utf-8');
// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
//$sessionTimeout = 3; // session time set,设置session时间
return array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'=>'My Web Application',

	//设置系统默认控制器
	'defaultController' => 'index',//重写CWebApplication
	
	// preloading 'log' component
	'preload'=>array('log'),

	// autoloading model and component classes
	'import'=>array(
		'application.models.*',
		'application.components.*',
	),

	'modules'=>array(
		// uncomment the following to enable the Gii tool
		
		'gii'=>array(
			'class'=>'system.gii.GiiModule',
			'password'=>'gii',
			// If removed, Gii defaults to localhost only. Edit carefully to taste.
			'ipFilters'=>array('127.0.0.1','::1'),
		),
		
		//引入创建的后台模块
		'backweb',
		
	),

	// application components
	'components'=>array(
		'session' => array(
//                        'class' => 'CDbHttpSession',
//                        'timeout' => $sessionTimeout,
         ),
		'user'=>array(
			// enable cookie-based authentication
			'allowAutoLogin'=>true,
			'loginUrl'=>'./index.php?r=user/login',//指定默认登陆页面
		),
		'cache'=>array(
			'class'=>'system.caching.CFileCache',
		),

		// uncomment the following to enable URLs in path-format
		
//		'urlManager'=>array(
//			'urlFormat'=>'path',
//			'rules'=>array(
//				'<controller:\w+>/<id:\d+>'=>'<controller>/view',
//				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
//				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
//			),
//			'rules'=>array(
//				'user/login'=>array('user/login','urlSuffix'=>'.html'),
//				'user/register'=>array('user/register','urlSuffix'=>'.html'),
//		
//				//省略方法和参数
//				'goods/<_goods_id:\d+>' => 'goods/details',
//				'goods/<brand:\d+>-<category:\d+>' => array('goods/category','urlSuffix'=>'.html'),
//			),
//		),
		

		// database settings are configured in database.php
		/*
		 * 注释默认配置
		 */
		//'db'=>require(dirname(__FILE__).'/database.php'),
		
		/**
		 * 自定义数据库配置
		 */
		'db' => array(
			'connectionString' => 'mysql:host=127.0.0.1;dbname=xysc',
			'emulatePrepare' => true,
			'username' => 'root',
			'password' => 'root',
			'charset' => 'utf8',
			'enableProfiling' =>'true',//显示每个sql运行时间
			'tablePrefix' => 'xy_',
			'enableParamLogging' => 'true',
		),
		
		'errorHandler'=>array(
			// use 'site/error' action to display errors
			'errorAction'=>YII_DEBUG ? null : 'site/error',
		),

		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(
				
				/*-----------20160601----------
				array(
					'class'=>'CFileLogRoute',
					'levels'=>'error, warning',
				),
				//个人
				array(
				'class'=>'CProfileLogRoute',
				'levels'=>'error, warning',
				),*/
		
		
				// uncomment the following to show log messages on web pages
				/**
				 * 开启日志
				 */
				//开启查看日志信息
				
		
				/*-----------20160601----------
				array(
					'class'=>'CWebLogRoute',
				),*/
		
		
				
			),
		),

	),
	
	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	'params'=>array(
		// this is used in contact page
		'adminEmail'=>'webmaster@example.com',
//		'session_timeout'=> $sessionTimeout,//配置session
	),
);
